Char

class Char : Comparable<Char>

Represents a 16-bit Unicode character.

On the JVM, non-nullable values of this type are represented as values of the primitive type char.

Types

Companion
Link copied to clipboard
Common
object Companion

Functions

compareTo
Link copied to clipboard
Common
open operator override fun compareTo(other: Char): Int

Compares this value with the specified value for order.

dec
Link copied to clipboard
Common
operator fun dec(): Char

Decrements this value.

inc
Link copied to clipboard
Common
operator fun inc(): Char

Increments this value.

minus
Link copied to clipboard
Common
operator fun minus(other: Char): Int

Subtracts the other Char value from this value resulting an Int.

operator fun minus(other: Int): Char

Subtracts the other Int value from this value resulting a Char.

plus
Link copied to clipboard
Common
operator fun plus(other: Int): Char

Adds the other Int value to this value resulting a Char.

rangeTo
Link copied to clipboard
Common
operator fun rangeTo(other: Char): CharRange

Creates a range from this value to the specified other value.

toByte
Link copied to clipboard
Common
@DeprecatedSinceKotlin(warningSince = "1.5")
fun toByte(): Byte

Returns the value of this character as a Byte.

toChar
Link copied to clipboard
Common
fun toChar(): Char

Returns the value of this character as a Char.

toDouble
Link copied to clipboard
Common
@DeprecatedSinceKotlin(warningSince = "1.5")
fun toDouble(): Double

Returns the value of this character as a Double.

toFloat
Link copied to clipboard
Common
@DeprecatedSinceKotlin(warningSince = "1.5")
fun toFloat(): Float

Returns the value of this character as a Float.

toInt
Link copied to clipboard
Common
@DeprecatedSinceKotlin(warningSince = "1.5")
fun toInt(): Int

Returns the value of this character as a Int.

toLong
Link copied to clipboard
Common
@DeprecatedSinceKotlin(warningSince = "1.5")
fun toLong(): Long

Returns the value of this character as a Long.

toShort
Link copied to clipboard
Common
@DeprecatedSinceKotlin(warningSince = "1.5")
fun toShort(): Short

Returns the value of this character as a Short.

Extensions

category
Link copied to clipboard
val Char.category: CharCategory
val Char.category: CharCategory
val Char.category: CharCategory
val Char.category: CharCategory

Returns the Unicode general category of this character.

code
Link copied to clipboard
Common
val Char.code: Int

Returns the code of this Char.

digitToInt
Link copied to clipboard
Common
fun Char.digitToInt(): Int

Returns the numeric value of the decimal digit that this Char represents. Throws an exception if this Char is not a valid decimal digit.

fun Char.digitToInt(radix: Int): Int

Returns the numeric value of the digit that this Char represents in the specified radix. Throws an exception if the radix is not in the range 2..36 or if this Char is not a valid digit in the specified radix.

digitToIntOrNull
Link copied to clipboard
Common
fun Char.digitToIntOrNull(): Int?

Returns the numeric value of the decimal digit that this Char represents, or null if this Char is not a valid decimal digit.

fun Char.digitToIntOrNull(radix: Int): Int?

Returns the numeric value of the digit that this Char represents in the specified radix, or null if this Char is not a valid digit in the specified radix. Throws an exception if the radix is not in the range 2..36.

directionality
Link copied to clipboard
val Char.directionality: CharDirectionality

Returns the Unicode directionality property for the given character.

downTo
Link copied to clipboard
Common
infix fun Char.downTo(to: Char): CharProgression

Returns a progression from this value down to the specified to value with the step -1.

equals
Link copied to clipboard
Common
fun Char.equals(other: Char, ignoreCase: Boolean = false): Boolean

Returns true if this character is equal to the other character, optionally ignoring character case.

isDefined
Link copied to clipboard
fun Char.isDefined(): Boolean
inline fun Char.isDefined(): Boolean
fun Char.isDefined(): Boolean
fun Char.isDefined(): Boolean

Returns true if this character (Unicode code point) is defined in Unicode.

isDigit
Link copied to clipboard
fun Char.isDigit(): Boolean
inline fun Char.isDigit(): Boolean
fun Char.isDigit(): Boolean
fun Char.isDigit(): Boolean

Returns true if this character is a digit.

isHighSurrogate
Link copied to clipboard
Common
fun Char.isHighSurrogate(): Boolean
inline fun Char.isHighSurrogate(): Boolean
fun Char.isHighSurrogate(): Boolean
external fun Char.isHighSurrogate(): Boolean

Returns true if this character is a Unicode high-surrogate code unit (also known as leading-surrogate code unit).

isIdentifierIgnorable
Link copied to clipboard
inline fun Char.isIdentifierIgnorable(): Boolean
external fun Char.isIdentifierIgnorable(): Boolean

Returns true if this character (Unicode code point) should be regarded as an ignorable character in a Java identifier or a Unicode identifier.

isISOControl
Link copied to clipboard
fun Char.isISOControl(): Boolean
inline fun Char.isISOControl(): Boolean
fun Char.isISOControl(): Boolean
external fun Char.isISOControl(): Boolean

Returns true if this character is an ISO control character.

isJavaIdentifierPart
Link copied to clipboard
inline fun Char.isJavaIdentifierPart(): Boolean

Returns true if this character (Unicode code point) may be part of a Java identifier as other than the first character.

isJavaIdentifierStart
Link copied to clipboard
inline fun Char.isJavaIdentifierStart(): Boolean

Returns true if this character is permissible as the first character in a Java identifier.

isLetter
Link copied to clipboard
fun Char.isLetter(): Boolean
inline fun Char.isLetter(): Boolean
fun Char.isLetter(): Boolean
fun Char.isLetter(): Boolean

Returns true if this character is a letter.

isLetterOrDigit
Link copied to clipboard
fun Char.isLetterOrDigit(): Boolean
inline fun Char.isLetterOrDigit(): Boolean
fun Char.isLetterOrDigit(): Boolean
fun Char.isLetterOrDigit(): Boolean

Returns true if this character is a letter or digit.

isLowerCase
Link copied to clipboard
fun Char.isLowerCase(): Boolean
fun Char.isLowerCase(): Boolean
fun Char.isLowerCase(): Boolean

Returns true if this character is a lower case letter.

inline fun Char.isLowerCase(): Boolean

Returns true if this character is lower case.

isLowSurrogate
Link copied to clipboard
Common
fun Char.isLowSurrogate(): Boolean
inline fun Char.isLowSurrogate(): Boolean
fun Char.isLowSurrogate(): Boolean
external fun Char.isLowSurrogate(): Boolean

Returns true if this character is a Unicode low-surrogate code unit (also known as trailing-surrogate code unit).

isSurrogate
Link copied to clipboard
Common
fun Char.isSurrogate(): Boolean

Returns true if this character is a Unicode surrogate code unit.

isTitleCase
Link copied to clipboard
fun Char.isTitleCase(): Boolean
inline fun Char.isTitleCase(): Boolean
fun Char.isTitleCase(): Boolean
fun Char.isTitleCase(): Boolean

Returns true if this character is a title case letter.

isUpperCase
Link copied to clipboard
fun Char.isUpperCase(): Boolean
fun Char.isUpperCase(): Boolean
fun Char.isUpperCase(): Boolean

Returns true if this character is an upper case letter.

inline fun Char.isUpperCase(): Boolean

Returns true if this character is upper case.

isWhitespace
Link copied to clipboard
fun Char.isWhitespace(): Boolean
fun Char.isWhitespace(): Boolean
fun Char.isWhitespace(): Boolean
fun Char.isWhitespace(): Boolean

Determines whether a character is whitespace according to the Unicode standard. Returns true if the character is whitespace.

lowercase
Link copied to clipboard
fun Char.lowercase(locale: Locale): String

Converts this character to lower case using Unicode mapping rules of the specified locale.

fun Char.lowercase(): String
inline fun Char.lowercase(): String
inline fun Char.lowercase(): String
fun Char.lowercase(): String

Converts this character to lower case using Unicode mapping rules of the invariant locale.

lowercaseChar
Link copied to clipboard
fun Char.lowercaseChar(): Char
inline fun Char.lowercaseChar(): Char
inline fun Char.lowercaseChar(): Char
fun Char.lowercaseChar(): Char

Converts this character to lower case using Unicode mapping rules of the invariant locale.

plus
Link copied to clipboard
Common
inline operator fun Char.plus(other: String): String

Concatenates this Char and a String.

titlecase
Link copied to clipboard
Common
fun Char.titlecase(): String

Converts this character to title case using Unicode mapping rules of the invariant locale.

fun Char.titlecase(locale: Locale): String

Converts this character to title case using Unicode mapping rules of the specified locale.

titlecaseChar
Link copied to clipboard
fun Char.titlecaseChar(): Char
inline fun Char.titlecaseChar(): Char
fun Char.titlecaseChar(): Char
fun Char.titlecaseChar(): Char

Converts this character to title case using Unicode mapping rules of the invariant locale.

toLowerCase
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.5")
fun Char.toLowerCase(): Char
@DeprecatedSinceKotlin(warningSince = "1.5")
inline fun Char.toLowerCase(): Char
@DeprecatedSinceKotlin(warningSince = "1.5")
inline fun Char.toLowerCase(): Char
@DeprecatedSinceKotlin(warningSince = "1.5")
fun Char.toLowerCase(): Char

Converts this character to lower case using Unicode mapping rules of the invariant locale.

toTitleCase
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.5")
inline fun Char.toTitleCase(): Char

Converts this character to title case using Unicode mapping rules of the invariant locale.

toUpperCase
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.5")
fun Char.toUpperCase(): Char
@DeprecatedSinceKotlin(warningSince = "1.5")
inline fun Char.toUpperCase(): Char
@DeprecatedSinceKotlin(warningSince = "1.5")
inline fun Char.toUpperCase(): Char
@DeprecatedSinceKotlin(warningSince = "1.5")
fun Char.toUpperCase(): Char

Converts this character to upper case using Unicode mapping rules of the invariant locale.

until
Link copied to clipboard
Common
infix fun Char.until(to: Char): CharRange

Returns a range from this value up to but excluding the specified to value.

uppercase
Link copied to clipboard
fun Char.uppercase(locale: Locale): String

Converts this character to upper case using Unicode mapping rules of the specified locale.

fun Char.uppercase(): String
inline fun Char.uppercase(): String
inline fun Char.uppercase(): String
fun Char.uppercase(): String

Converts this character to upper case using Unicode mapping rules of the invariant locale.

uppercaseChar
Link copied to clipboard
fun Char.uppercaseChar(): Char
inline fun Char.uppercaseChar(): Char
fun Char.uppercaseChar(): Char
fun Char.uppercaseChar(): Char

Converts this character to upper case using Unicode mapping rules of the invariant locale.